package com.tangtang.core.validator;

import com.tangtang.core.StringUtil;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

/**
 * Created by Administrator on 2014/4/10.
 */
public class MustNotBlankValidator implements ConstraintValidator<MustNotBlank, String> {

    MustNotBlank mustNotBlank;

    @Override
    public void initialize(MustNotBlank constraintAnnotation) {
        this.mustNotBlank = constraintAnnotation;
    }

    @Override
    public boolean isValid(String value, ConstraintValidatorContext context) {
        return StringUtil.isNotBlank(value);
    }
}
